//
//  NSObject+MolonAPI.h
//
//  Created by Molon on 13-9-30.
//  Copyright (c) 2013年 Molon. All rights reserved.
//

#import <Foundation/Foundation.h>

@class MolonRequestHelper;
/**
 *  让所有对象都能支持接受请求返回结果的类目
 */
@interface NSObject (MolonAPI)

// 下面四个可继承作为请求回调继承使用

/**
*  在请求结束之后一定会执行的方法
*/
- (void)mustExecuteAfterRequestCompleted:(MolonRequestHelper *)requestHelper;
/**
 *  下面几个分别为请求成功、失败、错误，预加载缓存之后会执行的
 */
- (void)requestSucceeded:(MolonRequestHelper *)requestHelper;
- (void)requestFailed:(MolonRequestHelper *)requestHelper;
- (void)requestError:(MolonRequestHelper *)requestHelper;

- (void)cachePreloaded:(MolonRequestHelper *)requestHelper;

//另外如果有需要关心的接口，可以执行此方法
- (void)careForRequestHelperClass:(Class)helperClass;
//下面这个和上面是联合的，需要继承作为回调
- (void)updatedCareForRequestHelper:(MolonRequestHelper*)requestHelper andBindObject:(id)bindObject;

//下面几个不需要关心是MolonAPI内部需要调用的
- (void)ml_nsobject_requestSucceeded:(MolonRequestHelper *)requestHelper;
- (void)ml_nsobject_requestFailed:(MolonRequestHelper *)requestHelper;
- (void)ml_nsobject_requestError:(MolonRequestHelper *)requestHelper;
//这个注意，这个只在MolonRequestHelperCacheTypeFirstReturnInvalidCacheAndRequest和MolonRequestHelperCacheTypeFirstReturnCacheAndAlwaysRequest下才会触发调用
- (void)ml_nsobject_cachePreloaded:(MolonRequestHelper *)requestHelper;

@end
